 <%--
 *  File:   HospitalPurchaseVerify.jsp
 *  Desc:	the Lend slip summary page
 *
 *  Date		  Author		  Changes
 *  2011-1-25	  KevinFan		  Created
 *
 *  Copyright (C) 2000 - 2011 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>
<%
  //init param
  String privilegeCode = "A0102,A0106";
  String strTableName = "v_zylpurchaseverifysummary";
  String strModuleName = "TDR";
  String contextPath = request.getContextPath();
%>
<%@ include file="/inc/CommonHeader.inc" %>
<%@ include file="/inc/OvalLocationDefault.inc" %>

<html>
<head>
<title>PharmacyPurchaseVerify</title>
<PageFlow:CheckPageFlow pageName="p_purchaseverify"/>
<%
  HashMap userinfo = (HashMap)session.getAttribute("userinfo");
  Vector summary = (Vector)pageContext.getAttribute("totalsummary");
  Integer style1 = (Integer) pageContext.getAttribute("style");
  String style = style1.toString();
  String flag = (String)pageContext.getAttribute("flag");
  String  issalesman = (String) userinfo.get("issalesman");
  int endday1 = Integer.parseInt((String)pageContext.getAttribute("endday1"));
  int endday2 = Integer.parseInt((String)pageContext.getAttribute("endday2"));
  String  username = (String) userinfo.get("employeename");
  java.util.Calendar cal = java.util.Calendar.getInstance();      
  int day = cal.get(Calendar.DAY_OF_MONTH);
  if(summary == null)summary = new Vector();
%>
<%@ include file="/inc/CatchError.inc" %>
<%@ include file="/inc/SumDiv.inc" %>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath%>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath%>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/ScriptLib.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/SummaryDivision.js"></script>
<script language="JavaScript">
function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(cform,actionvalue,orderbyname);
  if(!editform) return;
  editform.action = "HospitalPurchaseVerify.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();
}

function subDiv() {
	//alert();
   // var req = new Request({
   //     url: '../../Dispatcher',
    //    onSuccess: function(txt) {
   //         hidDiv("submit");
   //     }
   // }); 
   // alert();
   // var remark = document.getElementsByName("remark")[0].value;
   // alert(remark);
   // var purchasemonthdataid = document.getElementsByName("purchasemonthdataid")[0].value;
   // alert(purchasemonthdataid);
   // req.send('actionname=save&pagename=p_purchaseverify&purchasemonthdataid' + purchasemonthdataid + '&remark'+remark);
   	document.cform.actionname.value = "saveh";
  	document.cform.target = "_self";
  	isRunning = true;
  	document.cform.submit();
}

function showDiv(element) {
    var W = document.documentElement.scrollWidth;
    var H = document.documentElement.scrollHeight;
    var selfW = document.getElementById(element).style.width;
    var selfH = document.getElementById(element).style.height;
    document.getElementById(element).style.left = (W - parseInt(selfW)) / 2 + 'px';
    document.getElementById(element).style.top = (H - parseInt(selfH)) / 2 + 'px';
    document.getElementById(element).style.display = 'block';
    var mDiv = document.getElementById("mDiv");
    mDiv.style.display = '';
    document.cform.subbutton.focus();
    
}

function hidDiv(element) {
    document.getElementById(element).style.display = 'none';
    document.getElementById("mDiv").style.display = 'none';
}

function clickRow(obj,idx)
{
  var cform = document.cform;
  cform.purchasemonthdata_id.value = eval('obj.all.purchasemonthdataid'+idx).value;
  
  cform.orgid.value = eval('obj.all.orgid'+idx).value;
  cform.partnerid.value = eval('obj.all.partnerid'+idx).value;
  cform.prodid.value = eval('obj.all.prodid'+idx).value;
  cform.year.value = eval('obj.all.year'+idx).value;
  cform.month.value = eval('obj.all.month'+idx).value;
  cform.re_mark.value = eval('obj.all.remark'+idx).value;
  
  
}

function page_allcheckselect(){
	var allcheck = cform.allcheck.checked;
	var alldatafile = document.getElementsByName('deleteids');
	var length = alldatafile.length;
	if(allcheck){
		for(var i = 1 ; i <= length;i++){
			alldatafile[i-1].checked = true;
		}
	}else{
		for(var i = 1 ; i <= length;i++){
			alldatafile[i-1].checked = false;
		}	
	}
}

function page_pass(){
  if(isNullChecked(cform.deleteids)) 
  {
    alert('<%=message.getMessageDesc("PLEASE_SELECT")%>');
    return;
  }
  for(var i=0;i<cform.deleteids.length;i++){
		var n = i + 1;
		if(cform.deleteids[i].checked){
			if(eval('cform.folwqty'+n).value == "" || eval('cform.notfolwqty'+n).value == "" || eval('cform.qty'+n).value == "")
				{
				alert('<%=message.getMessageDesc("Verify_Pass")%>');
				return;
				}
		}
	  }
  if(!confirm("<%=message.getMessageDesc("ZYL_TDR_YESPASS")%>"))return;
  cform.changestatus.value = 41;
  cform.actionname.value = "approve";
  cform.target = "_self";
  isRunning = true;
  document.cform.submit();
}

function page_noPass(){
	if(isNullChecked(cform.deleteids)) 
  {
    alert('<%=message.getMessageDesc("PLEASE_SELECT")%>');
    return;
  }
	 for(var i=0;i<cform.deleteids.length;i++){
			var n = i + 1;
			if(cform.deleteids[i].checked){
				if(eval('cform.folwqty'+n).value == "" || eval('cform.notfolwqty'+n).value == "" || eval('cform.qty'+n).value == ""){alert('<%=message.getMessageDesc("Verify_Pass")%>');return;}
			}
		  }
  if(!confirm("<%=message.getMessageDesc("ZYL_TDR_NOTPASS")%>"))return;
  cform.changestatus.value = 28;
  cform.actionname.value = "approve";
  cform.target = "_self";
  isRunning = true;
  document.cform.submit();
}

function page_reTypeIn(){
	if(isNullChecked(cform.deleteids)) 
  {
    alert('<%=message.getMessageDesc("PLEASE_SELECT")%>');
    return;
  }
	 for(var i=0;i<cform.deleteids.length;i++){
			var n = i + 1;
			if(cform.deleteids[i].checked){
				if(eval('cform.status'+n).value != "28"){alert('<%=label.getLabelName("L_PleseNoPass") %>');return;}
			}
		  }
  cform.actionname.value = "retypeinh";
  cform.target = "_self";
  isRunning = true;
  document.cform.submit();
}
function page_salesDetail()
{
	orgid = cform.orgid.value;
    partnerid =cform.partnerid.value;
    if(isEmpty(orgid)) 
	  {
	    alert('<%=message.getMessageDesc("PLEASE_SELECT")%>');
	    return;
	  }
    productid = cform.prodid.value;
    year = cform.year.value;
    month = cform.month.value;
    businesstype = cform.businesstype.value;
	<%if(!"Y".equals(issalesman)){%>
    regionid = cform.regionid.value;
    userids = cform.userids.value;
	proviceofficecode = document.cform.proviceofficelist.value;
	businessareacode = document.cform.businessarealist.value;
	popup('<%=contextPath %>/tdr/dataverify/SalesDetail.jsp?<%= OvalTools.randomURL() %>&businesstype='+businesstype+'&orgid='+orgid+'&partnerid='+partnerid+'&productid='+productid+'&year='+year+'&month='+month +'&userids='+userids + '&proviceofficecode='+proviceofficecode + '&businessareacode='+businessareacode+'&regionid='+regionid,'newwindow','height=500, width=900,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no');
    <%}else{%>
	popup('<%=contextPath %>/tdr/dataverify/SalesDetail.jsp?<%= OvalTools.randomURL() %>&businesstype='+businesstype+'&orgid='+orgid+'&partnerid='+partnerid+'&productid='+productid+'&year='+year+'&month='+month,'newwindow','height=500, width=900,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no');
	<%}%>
}

function page_purchaseDetail()
{
	orgid = cform.orgid.value;
    partnerid =cform.partnerid.value;
   	if(isEmpty(orgid)) 
	  {
	    alert('<%=message.getMessageDesc("PLEASE_SELECT")%>');
	    return;
	  }
    productid = cform.prodid.value;
    year = cform.year.value;
    month = cform.month.value;
    businesstype = cform.businesstype.value;
	<%if(!"Y".equals(issalesman)){%>
    regionid = cform.regionid.value;
    userids = cform.userids.value;
	proviceofficecode = document.cform.proviceofficelist.value;
	businessareacode = document.cform.businessarealist.value;
	popup('<%=contextPath %>/tdr/dataverify/PurchaseDetail.jsp?<%= OvalTools.randomURL() %>&businesstype='+businesstype+'&orgid='+orgid+'&partnerid='+partnerid+'&productid='+productid+'&year='+year+'&month='+month +'&userids='+userids + '&proviceofficecode='+proviceofficecode + '&businessareacode='+businessareacode+'&regionid='+regionid,'newwindow','height=500, width=900,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no');
	<%}else{%>
	popup('<%=contextPath %>/tdr/dataverify/PurchaseDetail.jsp?<%= OvalTools.randomURL() %>&businesstype='+businesstype+'&orgid='+orgid+'&partnerid='+partnerid+'&productid='+productid+'&year='+year+'&month='+month,'newwindow','height=500, width=900,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no');
	<%}%>
}


//salesman
function popRep() {
	var regionid=cform.regionid.value;
	var proviceofficecode = document.cform.proviceofficelist.value;
	var businessareacode = document.cform.businessarealist.value;
	var status = "height=400, width=600, top=100, left=100, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no";
	var url = "SalesPopWindow.jsp?<%= OvalTools.randomURL() %>&regionid="+regionid+"&proviceofficecode="+proviceofficecode+"&businessareacode="+businessareacode;
  
	popwindow = window.open(url, "newwindow", status);
  }

function SetSalesMan(id,code,name){
	cform.userids.value=id;
	cform.employeecode.value=code;
	cform.employeename.value=name;
}

//getsecond 
function page_getpriviceoffice(){
	var objdeptcode=eval("cform.regionid");
	var style = document.cform.style.value;
	if (objdeptcode==""){
	    return;
	}
	var  datahandler = new  DataHandler();
	datahandler.add_params("style" , style, 'Integer');
	datahandler.add_params("regionid" , objdeptcode.value , "Integer");
	datahandler.getResultFromVector("resultproviceoffice","proviceofficename","proviceofficecode","document.cform.proviceofficelist");
	datahandler.add_job("j_purchaseverify");
	datahandler.runDataHandler();
  }



function page_getbusinessarea(){
	var objdeptcode=eval("cform.proviceofficelist");
	var regionid = document.cform.regionid.value;
	var style = document.cform.style.value;
	if (objdeptcode==""){
	    return;
	}
	var  datahandler = new  DataHandler();
	datahandler.add_params("style" , style, 'Integer');
	datahandler.add_params("regionid" , regionid , "Integer");
	datahandler.add_params("proviceofficelist" , objdeptcode.value , "String");
	datahandler.getResultFromVector("resultbusinessarea","businessareaname","businessareacode","document.cform.businessarealist");
	datahandler.add_job("j_purchaseverify");
	datahandler.runDataHandler();
 }


</script>
</head>

<body style="overflow: auto;">
<iframe id="reloadHandler" name="reloadHandler" style="display:none"></iframe>
<form name="cform" method="post" action="<%=contextPath%>/Dispatcher">
    <input type="hidden" name="pagename" value="p_purchaseverify">
    <input type="hidden" name="actionname">
    <custom:hidden property="style"/>
    <custom:hidden property="changestatus"/>
    <custom:hidden property="businesstype"/>
    <custom:hidden property="orgid"/>
	<custom:hidden property="partnerid"/>
	<custom:hidden property="prodid"/>
<custom:hidden property="year"></custom:hidden>
<custom:hidden property="month"></custom:hidden>
<%--  page location   --%>
    <%@ include file="/inc/PageLocation.inc" %>
    <table width="100%" cellspacing="0" border="0" cellpadding="0">
      <tr>
<%--  search criteria  --%>
      </tr>
      <tr>
        <td>
          <table width="100%" border="0" cellspacing="0">
          	<tr>
	          <td class="summary_top" width="10%" colspan="3"></td>
	        </tr>
            <%@ include file="/inc/SummarySearch.inc" %>
          </table>
        </td>
      </tr>
      <tr>
        <td>
  <table width="500" border="0" cellspacing="0" >
        	<tr>
        		<%       
					String year = cal.get(Calendar.YEAR)+"";     
					String month = cal.get(Calendar.MONTH)+"";
					if(cal.get(Calendar.MONTH) == 0){
						month = "12";
						year = (cal.get(Calendar.YEAR)-1)+"";
					}  
					if("first".equals(flag)){ 
				%>
	        	<td style="width:40px;" class="td_right" ><%=label.getLabelName("L_Year1") +  label.getLabelName("L_Colon") %></td>
	        	<td style="width:50px;" class="td_left"><custom:selectdic property="years" dictType="Years" command="notnull" value="<%=year %>" label="L_Year1"/></td>
	        	<td style="width:40px;" class="td_right"><%=label.getLabelName("L_Month") +  label.getLabelName("L_Colon") %></td>
	        	<td style="width:50px;" class="td_left"><custom:selectdic property="months" dictType="Months" command="notnull" value="<%=month %>" label="L_Month"/></td>
	        	<%}else{ %>
	        	<td style="width:40px;" class="td_right"><%=label.getLabelName("L_Year1") +  label.getLabelName("L_Colon") %></td>
	        	<td style="width:50px;" class="td_left"><custom:selectdic property="years" dictType="Years" command="notnull" label="L_Year1"/></td>
	        	<td style="width:40px;" class="td_right"><%=label.getLabelName("L_Month") +  label.getLabelName("L_Colon") %></td>
	        	<td style="width:50px;" class="td_left"><custom:selectdic property="months" dictType="Months" command="notnull" label="L_Month"/></td>
	        	    <%
	        	    }
					if("1".equals(style)){
					%>
					 <td style="width:40px;" class="td_right"><%=label.getLabelName("L_Status") +  label.getLabelName("L_Colon") %></td>
	        	<td style="width:50px;" class="td_left"><custom:selectdic property="status" dictType="ZylStatus" valueCriteria="40,28,41" defaultValue="-------" defaultValueCost="" command="notnull" label="Status"/></td>
					<% }
					
					else{ 
						if("Y".equals(issalesman)){
			        %>
	        	<td style="width:40px;" class="td_right"><%=label.getLabelName("L_Status") +  label.getLabelName("L_Colon") %></td>
	        	<td style="width:50px;" class="td_left"><custom:selectdic property="status" dictType="ZylStatus" valueCriteria="41,28" defaultValue="-------"  defaultValueCost="" command="notnull" label="Status"/></td>
        	    <%}else{ %>
        	    <td style="width:40px;" class="td_right"><%=label.getLabelName("L_Status") +  label.getLabelName("L_Colon") %></td>
	        	<td style="width:50px;" class="td_left"><custom:selectdic property="status" dictType="ZylStatus" valueCriteria="40,28,41" defaultValue="-------" defaultValueCost="" command="notnull" label="Status"/></td>
				<%}}%>
        	    </tr>
				</table>
				</td></tr>
				<tr>
        <td>
  <table width="1000" border="0" cellspacing="0" >
        	     <% 
	                if("Y".equals(issalesman)){
	             %> 
	                  <tr>
	                <td style="width:40px;">&nbsp;</td><td style="width:150px;">&nbsp;</td>
	               <td style="width:40px;">&nbsp;</td><td style="width:150px;">&nbsp;</td>
	               <td style="width:40px;">&nbsp;</td><td style="width:150px;">&nbsp;</td>
	               <td style="width:60px;">&nbsp;</td><td style="width:150px;">&nbsp;</td>
	               <td style="width:60px;">&nbsp;</td><td style="width:150px;">&nbsp;</td>
	               </tr>
	                <%}else{ %>
        	    <tr>
        	    <td style="width:40px;" class="td_right"><%=label.getLabelName("L_Businessarea") +  label.getLabelName("L_Colon") %></td>
        	  	<td style="width:150px;" class="td_left"><custom:select property="regionid" optionInnerTextKey="regionname" style="width:150px" optionsName="resultregion" optionValueKey="regionid" onchange="page_getpriviceoffice()" defaultValue="ALL" defaultValueCost=""/></td>
        	    <td style="width:40px;" class="td_right"><%=label.getLabelName("L_ProvinceOffice") +  label.getLabelName("L_Colon") %></td>
				<td style="width:150px;" class="td_left">
					<custom:select property="proviceofficelist" optionInnerTextKey="proviceofficename" optionsName="resultproviceoffice" optionValueKey="proviceofficecode" defaultValue="----------" style="width:150px" defaultValueCost="" onchange="page_getbusinessarea();"/>
		        </td>
			    <td style="width:60px;" class="td_right"><%=label.getLabelName("L_BusinessAreaName") +  label.getLabelName("L_Colon") %></td>
				<td style="width:150px;" class="td_left">
				<custom:select property="businessarealist" optionInnerTextKey="businessareaname" optionsName="resultbusinessarea" optionValueKey="businessareacode" defaultValue="----------" style="width:150px" defaultValueCost=""/> </td>
        	     <td style="width:60px;" class="td_right"><%=label.getLabelName("L_BusinessContact") +  label.getLabelName("L_Colon") %></td>
				<td style="width:150px;">
			<custom:text property="employeename" size="20" readonly="true" style="border:1px #7F9DB9 solid;"/>
			<a onClick="javascript:popRep();"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0"/></a> 
			<custom:hidden property="userids"/>
			<custom:hidden property="employeecode"/>
		   </td>
				<td style="20px;"><button type="reset" class="button1" name="re" value="clear"  style="width:60"><%=label.getLabelName("L_Clear") %></button></td>
			<%} %>
        	</tr>
          </table>
        </td>
      </tr>
      <tr>
        <td>
	        <table width="1500" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
	        <tr class="deepblue-left"> 
	          <td width="1%" class="title_center"><input type="checkbox" name="allcheck" class="normalradio" onclick="page_allcheckselect();"></td>
	          <td class="title_center" width="15%" ><a href="javascript:page_summary('orderby','orgcode')"><%= label.getLabelName("L_Dealer") %></a></td>
	      <!--<td class="title_center" width="8%" ><a href="javascript:page_summary('orderby','orgname')"><%= label.getLabelName("L_DTorgname") %></a></td> -->
	          <td class="title_center" width="15%"><a href="javascript:page_summary('orderby','partnercode')"><%= label.getLabelName("L_Pharmacy") %></a></td>
	      <!--<td class="title_center" width="7%" ><a href="javascript:page_summary('orderby','partnername')"><%= label.getLabelName("L_HospitalName") %></a></td> -->
	          <td class="title_center" width="6%" ><a href="javascript:page_summary('orderby','repname')"><%= label.getLabelName("L_Representative") %></a></td>
	          <td class="title_center" width="10%" ><a href="javascript:page_summary('orderby','prodcode')"><%= label.getLabelName("L_Product") %></a></td>
	      <!-- <td class="title_center" width="7%" ><a href="javascript:page_summary('orderby','prodname')"><%= label.getLabelName("L_ProdName") %></a></td> -->
	          <td class="title_center" width="11%" ><a href="javascript:page_summary('orderby','folwqty')"><%= label.getLabelName("L_FlowInPurchased") %></a></td>
	          <td class="title_center" width="11%" ><a href="javascript:page_summary('orderby','notfolwqty')"><%= label.getLabelName("L_NotFlowInPurchased") %></a></td>
	          <td class="title_center" width="11%" ><a href="javascript:page_summary('orderby','salesqty')"><%= label.getLabelName("L_BusinessFlowPurchased") %></a></td>
	          <td class="title_center" width="7%" ><a href="javascript:page_summary('orderby','difference')"><%= label.getLabelName("L_Difference") %></a></td>
	          <td class="title_center" width="7%" ><a href="javascript:page_summary('orderby','status')"><%= label.getLabelName("L_Status") %></a></td>
	          <td class="title_center" width="7%" ><a href="javascript:page_summary('orderby','remark')"><%= label.getLabelName("L_NoteThat") %></a></td>
	        </tr> 
	        <tbody> 
	          <%
	            Integer nDefaultId = new Integer(-1);
	            int i=0;
	            String strChecked = "";
				String repname = "";
	            String strClassType = "none";
	            boolean bHasChecked = false;
	          %>
	          <logic:iterate id="onerow" collection="<%= summary %>">
	          <%
	            if(i%2 == 1){
	              strClassType = "td-listrom";
	            }else{
	              strClassType = "none";
	            }
	            String remark = (String)((HashMap)pageContext.getAttribute("onerow")).get("remark");
				repname = (String)((HashMap)pageContext.getAttribute("onerow")).get("repname");
	            if(!bHasChecked){
	              nDefaultId = (Integer)((HashMap)pageContext.getAttribute("onerow")).get("purchasemonthdataid");
	              bHasChecked = true;
	              strChecked = "Checked";
	            }else{
	              strChecked = "";
	            }
	            i++;
	          %>
	          <tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=JspHelper.filterNull( strClassType )%>'" onClick="javascript:clickRow(this,<%=JspHelper.filterNull( i ) %>);" class="<%=JspHelper.filterNull( strClassType )%>">
	            <!--<td>
	              <input <%=JspHelper.filterNull( strChecked )%> id="radio<%=JspHelper.filterNull(i)%>" name="radiorow" type="radio" class="normalradio">
	            </td>
	            --><td class="title_center">
	              <input id="deleteids<%=JspHelper.filterNull(i)%>" name="deleteids" type="checkbox" value="<custom:write name="onerow" property="purchasemonthdataid"/>" class="normalradio">
	            </td>
	            <td><custom:write name="onerow" property="orgcode" nbsp="true"/>&nbsp;<custom:write name="onerow" property="orgname" nbsp="true"/></td>
	            <!-- <td><custom:write name="onerow" property="orgname" nbsp="true"/></td> -->
	            <td><custom:write name="onerow" property="partnercode" nbsp="true"/>&nbsp;<custom:write name="onerow" property="partnername" nbsp="true"/></td>
	            <!-- <td><custom:write name="onerow" property="partnername" nbsp="true"/></td> -->
	            <td><custom:write name="onerow" property="repname" nbsp="true"/></td>
	            <td><custom:write name="onerow" property="prodcode" nbsp="true"/>&nbsp;<custom:write name="onerow" property="prodname" nbsp="true"/></td>
	            <!-- <td><custom:write name="onerow" property="prodname" nbsp="true"/></td> -->
	            <td><custom:write name="onerow" property="folwqty" nbsp="true"/></td>
	            <td><custom:write name="onerow" property="notfolwqty" nbsp="true"/></td>
	            <td><custom:write name="onerow" property="qty" nbsp="true"/></td>
	            <td><custom:write name="onerow" property="difference" nbsp="true"/></td>
	            <td><custom:write name="onerow" dictType="ZylStatus" property="status" nbsp="true"/></td>
	            <%if(remark==null || remark==""){ %>
	            <td onclick="showDiv('submit')" ><a href="#"><%= label.getLabelName("L_Add") + label.getLabelName("L_Remarks")%></a>
	            <%}else{ %>
	            <td onclick="showDiv('submit')" ><custom:write name="onerow" property="remark" nbsp="true"/>
	            <%} %>
	            <%
	            String str1 = "purchasemonthdataid"+JspHelper.filterNull(i);
	            String str2 = "orgid"+JspHelper.filterNull(i);
	            String str3 = "partnerid"+JspHelper.filterNull(i);
	            String str4 = "prodid"+JspHelper.filterNull(i);
	            String str5 = "year"+JspHelper.filterNull(i);
	            String str6 = "month"+JspHelper.filterNull(i);
	            String str7 = "remark"+JspHelper.filterNull(i);
	            String str8 = "status"+JspHelper.filterNull(i);
	            String str9 = "folwqty"+JspHelper.filterNull(i);
				String str10 = "notfolwqty"+JspHelper.filterNull(i);
				String str11 = "qty"+JspHelper.filterNull(i);
	            %>
	            <custom:hidden name="onerow" property="purchasemonthdataid" changedName="<%=str1 %>"/>
	            <custom:hidden name="onerow" property="orgid" changedName="<%=str2 %>"/>
	            <custom:hidden name="onerow" property="partnerid" changedName="<%=str3 %>"/>
	            <custom:hidden name="onerow" property="prodid" changedName="<%=str4 %>"/>
	            <custom:hidden name="onerow" property="year" changedName="<%=str5 %>"/>
	            <custom:hidden name="onerow" property="month" changedName="<%=str6 %>"/>
	            <custom:hidden name="onerow" property="remark" changedName="<%=str7 %>"/>
	            <custom:hidden name="onerow" property="status" changedName="<%=str8 %>"/>
	            <custom:hidden name="onerow" property="folwqty" changedName="<%=str9 %>"/>
				<custom:hidden name="onerow" property="notfolwqty" changedName="<%=str10 %>"/>
				<custom:hidden name="onerow" property="qty" changedName="<%=str11 %>"/>
	            </td>
	          </tr>
	          </logic:iterate>
	        </tbody> 
	        <tfoot> 
	        <tr> 
	          <td colspan="14"> 
	          <%@ include file="/inc/SummaryAction.inc" %>
	          </td>
	        </tr>
	        </tfoot> 
	      </table>
          <table width="100%" cellspacing="0" cellpadding="0">
            <tr><td class="summary_top"></td></tr>
            <tr>
              <td class="td_center">
              	<%if(pageContext.getAttribute("totalsummary")!=null){%>
              	<%	if("1".equals(style) && day<endday1){%>
              	<a onclick="page_pass();"><custom:button type="1" label="L_Pass" imgsrc="Modify.gif" border="0" style="width:100"/></a>&nbsp;&nbsp;
              	<a onclick="page_noPass();"><custom:button type="1" label="L_Nopass" imgsrc="Modify.gif" border="0" style="width:100"/></a>&nbsp;&nbsp;
                <%} %>
                <a onclick="page_salesDetail();"><custom:button type="1" label="L_CheckSalesDetail" imgsrc="Modify.gif" border="0" style="width:100"/></a>&nbsp;&nbsp;
                <a onclick="page_purchaseDetail();"><custom:button type="1" label="L_CheckSPurchaseDetail" imgsrc="delete.gif" border="0" style="width:100"/></a>&nbsp;&nbsp;
				<%	if(!("1".equals(style)) && day<endday2 && username.equals(repname)){%>
				<a onclick="page_reTypeIn();"><custom:button type="1" label="L_ReTypeIn" imgsrc="delete.gif" border="0" style="width:100"/></a>&nbsp;&nbsp;
              	<%}} %>
              </td>
            </tr>
          </table>
        </td>
      </tr>
    </table>
    
<!-- Large Text Input Window -->
<div id="submit" class="deepblue-left"
     style="width:400px;height:125px;border:5px #999999 double;position:absolute;display:none">
    <div id="close" class="deepblue-left" style="width:400px;height:25px;text-align:right;cursor:move;"><img
            src="../../images/closeXXX.jpg" style="cursor:hand" onclick="hidDiv('submit')"></div>
    <div style="text-algin:center;height:100px;">
        <table cellspacing="0" cellpadding="0">
            <tr>
                <td height="100px">
                    <table border="1" width="395px" height="100px" cellspacing="0" cellpadding="0" align="center">
                        <tr>
                        <td align="right"><%= label.getLabelName("L_NoteThat") + label.getLabelName("L_Colon") %></td>
                        <td ><custom:textarea property="re_mark" cols="40" rows="3"/>
                        <custom:hidden property="purchasemonthdata_id"/></td>
                        </tr>
                        <tr>
                            <td class="td_center" colspan="2">
                                <input type="button" name="subbutton" value="<%=label.getLabelName("L_Confirm")%>"
                                       onclick="subDiv()"/>
                                <custom:button label="L_Cancel" onclick="hidDiv('submit')"></custom:button>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </div>
</div>
</form>
<iframe name="reloadHandler" style="display:none"></iframe>
<script type="text/javascript">
window.onload = function() {
    var newMask = document.createElement("div");
    newMask.id = "mDiv";
    newMask.style.position = "absolute";
    newMask.style.zIndex = "5000";
    _scrollWidth = Math.max(document.body.scrollWidth, document.documentElement.scrollWidth);
    _scrollHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
    newMask.style.width = "1500";
    newMask.style.height = "100%";
    newMask.style.top = "0px";
    newMask.style.left = "0px";
    newMask.style.background = "#33393C";
    newMask.style.filter = "alpha(opacity=40)";
    newMask.style.opacity = "0.40";
    newMask.style.display = 'none';
    newMask.innerHTML = '<iframe style="position:absolute;top:0;left:0;width:100%;height:100%;filter:alpha(opacity=0);"></iframe>'
    document.body.appendChild(newMask);
    document.getElementById("submit").style.zIndex = "5002";
    var objDrag = document.getElementById("close");
    var drag = false;
    var dragX = 0;
    var dragY = 0;
    objDrag.attachEvent("onmousedown", startDrag);
    function startDrag() {
        if (event.button == 1 && event.srcElement.tagName.toUpperCase() == "DIV") {
            event.srcElement.setCapture();
            event.srcElement.style.background = "#ECECEC";
            drag = true;
            dragX = event.clientX;
            dragY = event.clientY;
        }
    };
    objDrag.attachEvent("onmousemove", Drag);
    function Drag() {
        if (drag) {
            var oldwin = event.srcElement.parentNode;
            oldwin.style.left = oldwin.offsetLeft + event.clientX - dragX;
            oldwin.style.top = oldwin.offsetTop + event.clientY - dragY;
            oldwin.style.left = event.clientX - 100;
            oldwin.style.top = event.clientY - 10;
            dragX = event.clientX;
            dragY = event.clientY;
        }
    };
    objDrag.attachEvent("onmouseup", stopDrag);
    function stopDrag() {
        event.srcElement.style.background = "#90AAC5";
        event.srcElement.releaseCapture();
        drag = false;
    };
}

</script>
</body>
</html>
